package felix.dataviewer.Presenter;

import java.util.List;

import felix.dataviewer.Base.BasePresenter;
import felix.dataviewer.Base.BaseViewI;
import felix.dataviewer.Data.AppBean;
import felix.dataviewer.Model.AppModel;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers;

/**
 * Created by huangmf on 8/16/2017.
 */

public class AppPresenter extends BasePresenter<AppPresenter.AppViewI> {

    public void loadApp() {
        AppModel.getAppBean()
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(appBeen -> mView.loadApp(appBeen),
                        t -> t.printStackTrace());
    }

    public interface AppViewI extends BaseViewI {
        void loadApp(List<AppBean> appBeen);
    }
}
